#include "mysql.h"

//给mysql建立连接
//-1连接错误，0为连接正常
int server_mysql_init(MYSQL **conn){

    *conn = mysql_init(NULL);
    if (*conn == NULL) {
        fprintf(stderr, "mysql_init() failed\n");
        exit(1);
    }

    if (!mysql_real_connect(*conn, "localhost", "root", "123456", "user_file", 3306, NULL, 0)) {
        printf( "%s\n", mysql_error(*conn));
        return -1;
    }
    printf("inininit\n");
    return 0;
}
